// import { readFileSync, writeFileSync } from 'fs';
// import { compile } from 'handlebars';
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config({ path: `./env/.env.${process.env.NODE_ENV || 'development'}` });
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require('fs');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Handlebars = require('handlebars');

// 读取模板文件
const templateSource = fs.readFileSync('./src/manifest.template.json', 'utf8');
const template = Handlebars.compile(templateSource);

// 定义外部变量
const variables = {
    APP_ID: process.env.APP_ID || 'wxdf8f5fc18fa98c6c'
};


// 渲染模板
const manifestContent = template(variables);

// 写入最终的 manifest.json 文件
fs.writeFileSync('./src/manifest.json', manifestContent, 'utf8');
console.log('Generated manifest.json successfully.');
